package com.hck.taozi_help;

import android.app.Application;
import android.app.KeyguardManager;

import com.hck.taozi_help.module.yuyin.KeDaYuYingManger;
import com.hck.taozi_help.utils.LogUtil;
import com.tencent.smtt.export.external.TbsCoreSettings;
import com.tencent.smtt.sdk.QbSdk;

import java.util.HashMap;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        initX5();
        KeDaYuYingManger.initializeMsc(getApplicationContext());
    }

    private void initX5(){
        HashMap map = new HashMap();
        map.put(TbsCoreSettings.TBS_SETTINGS_USE_SPEEDY_CLASSLOADER, true);
        map.put(TbsCoreSettings.TBS_SETTINGS_USE_DEXLOADER_SERVICE, true);
        QbSdk.initTbsSettings(map);
        boolean canLoadX5 = QbSdk.canLoadX5(getApplicationContext());
        LogUtil.log("canLoadX5canLoadX5: "+canLoadX5);
        if (canLoadX5){
            return;
        }
        QbSdk.reset(getApplicationContext());
        QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
            @Override
            public void onCoreInitFinished() {
                LogUtil.log("initX5Environment onCoreInitFinished");
            }

            @Override
            public void onViewInitFinished(boolean b) {
                LogUtil.log("onViewInitFinished "+b);
            }
        });

    }
}
